% Read the inkjet printed Neugebauer primaries information
function [ret_dc, ret_spec] = read_inkjet_neugebauer_primaries( ...
    fname_dc, ...
    fname_spec, ...
    fmin_lambda,...
    finterval,...
    fmax_lambda,...
    omin_lambda, ...
    ointerval,...
    omax_lambda )

    if nargin < 1
        [filename, pathname] = uigetfile( '*.txt', 'DC value for Neugebauer primaries' );
        fname_dc = strcat(pathname,filename);
        [filename, pathname] = uigetfile( '*.txt', 'Spectrum value for Neugebauer primaries' );
        fname_spec = strcat(pathname,filename);
    end

    cellular_dc = dlmread( fname_dc );
    cellular_spec = dlmread( fname_spec );

    % Seeking the Neugebauer primaries, which contains only 1 or 100 in
    % their digital count
    neu_idx = find( sum( ( cellular_dc == 100 | cellular_dc == 0 )' ) == 7 );
    ret_dc = cellular_dc( neu_idx, : );
    
    spec_unlim = cellular_spec( neu_idx, 1:end-1 );
    
    ret_spec = color_tool.ref2ref(...
        spec_unlim, ...
        fmin_lambda, finterval, fmax_lambda,...
        omin_lambda, ointerval, omax_lambda );

%     out_rows = size(spec_unlim,1);
%     out_cols = size(omin_lambda:ointerval:omax_lambda,2);
%     ret_spec = zeros(out_rows, out_cols);
%     for i=1:out_rows
%         ret_spec(i,:) = interp1(...
%             fmin_lambda:finterval:fmax_lambda,...
%             spec_unlim(i,:),...
%             omin_lambda:ointerval:omax_lambda);
%     end

end